/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entitytablemode;

import entity.Order;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author NgocNam
 */
public class OrderTableModel extends AbstractTableModel{
    manager.managerOrder mo;
    public OrderTableModel(manager.managerOrder mo){
        this.mo=mo;
    }
    @Override
    public int getRowCount() {
        return mo.getSize();
    }

    @Override
    public int getColumnCount() {
        return 8;
    }

    @Override
    public Object getValueAt(int row, int cloumn) {
        Order o=mo.getOrder(row);
        switch(cloumn){
            case 0:return o.getOrderID();
            case 1:return o.getEmployeeID();
            case 2:return o.getStratDate();
            case 3:return o.getEndDate();
            case 4:return o.getReasons();
            case 5:return o.getStatus();
            case 6:return o.getDateBackFact();
            case 7:return o.getResons_Delay();
              default: return null;        
        }
    }
    
    public String getColumnName(int column) {
        switch(column){
            case 0: return "Order ID";
            case 1: return "Employee Name";
            case 2: return "Star Date";
            case 3: return "End Date";
            case 4: return "Reasons";
            case 5: return "Status";
            case 6: return "Date Back Fact";
            case 7: return "Reasons Delay";
                default:return  null;
        }
    }
}
